package com.atguigu.security.custom;

import com.atguigu.model.system.SysUser;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * ClassName: CustomUser
 * Package: com.atguigu.security.custom
 * Description:
 *
 * @Author 蹇泽阳
 * @Create 2023/11/18 17:58
 * @Version 1.0
 */
public class CustomUser extends User {
  
  /**
   * 我们自己的用户实体对象，要调取用户信息时直接获取这个实体对象。（这里我就不写get/set方法了）
   */
  private SysUser sysUser;
  
  public CustomUser(SysUser sysUser, Collection<? extends GrantedAuthority> authorities) {
    super(sysUser.getUsername(), sysUser.getPassword(), authorities);
    this.sysUser = sysUser;
  }
  
  public SysUser getSysUser() {
    return sysUser;
  }
  
  public void setSysUser(SysUser sysUser) {
    this.sysUser = sysUser;
  }
  
}
